<html>
 <head>
  <link href="./leetcode-problem.css" rel="stylesheet" type="text/css">
 </head>
 <body>
  <div class="question_difficulty">
   难度：Medium
  </div>
  <div>
   <h1 class="question_title">
    640. Solve the Equation
   </h1>
   <p>
    Solve a given equation and return the value of
    <code>
     x
    </code>
    in the form of string "x=#value". The equation contains only '+', '-' operation, the variable
    <code>
     x
    </code>
    and its coefficient.
   </p>
   <p>
    If there is no solution for the equation, return "No solution".
   </p>
   <p>
    If there are infinite solutions for the equation, return "Infinite solutions".
   </p>
   <p>
    If there is exactly one solution for the equation, we ensure that the value of
    <code>
     x
    </code>
    is an integer.
   </p>
   <p>
    <b>
     Example 1:
    </b>
    <br>
   </p>
   <pre>
<b>Input:</b> "x+5-3+x=6+x-2"
<b>Output:</b> "x=2"
</pre>
   <p>
    <b>
     Example 2:
    </b>
    <br>
   </p>
   <pre>
<b>Input:</b> "x=x"
<b>Output:</b> "Infinite solutions"
</pre>
   <p>
    <b>
     Example 3:
    </b>
    <br>
   </p>
   <pre>
<b>Input:</b> "2x=x"
<b>Output:</b> "x=0"
</pre>
   <p>
    <b>
     Example 4:
    </b>
    <br>
   </p>
   <pre>
<b>Input:</b> "2x+3x-6x=x+2"
<b>Output:</b> "x=-1"
</pre>
   <p>
    <b>
     Example 5:
    </b>
    <br>
   </p>
   <pre>
<b>Input:</b> "x=x+2"
<b>Output:</b> "No solution"
</pre>
  </div>
  <div>
   <h1 class="question_title">
    640. 求解方程
   </h1>
   <p>
    求解一个给定的方程，将
    <code>
     x
    </code>
    以字符串"x=#value"的形式返回。该方程仅包含'+'，' - '操作，变量&nbsp;
    <code>
     x
    </code>
    &nbsp;和其对应系数。
   </p>
   <p>
    如果方程没有解，请返回&ldquo;No solution&rdquo;。
   </p>
   <p>
    如果方程有无限解，则返回&ldquo;Infinite solutions&rdquo;。
   </p>
   <p>
    如果方程中只有一个解，要保证返回值&nbsp;
    <code>
     x
    </code>
    &nbsp;是一个整数。
   </p>
   <p>
    <strong>
     示例 1：
    </strong>
   </p>
   <pre>
<strong>输入:</strong> "x+5-3+x=6+x-2"
<strong>输出:</strong> "x=2"
</pre>
   <p>
    <strong>
     示例 2:
    </strong>
   </p>
   <pre>
<strong>输入:</strong> "x=x"
<strong>输出:</strong> "Infinite solutions"
</pre>
   <p>
    <strong>
     示例 3:
    </strong>
   </p>
   <pre>
<strong>输入:</strong> "2x=x"
<strong>输出:</strong> "x=0"
</pre>
   <p>
    <strong>
     示例 4:
    </strong>
   </p>
   <pre>
<strong>输入:</strong> "2x+3x-6x=x+2"
<strong>输出:</strong> "x=-1"
</pre>
   <p>
    <strong>
     示例 5:
    </strong>
   </p>
   <pre>
<strong>输入:</strong> "x=x+2"
<strong>输出:</strong> "No solution"
</pre>
  </div>
 </body>
</html>